<template>
	<view class="page" :style="themeColor">
		<view class="flex benben-position-layout flex flex-wrap align-center bindMobile_flex_0"
			:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class='flex flex-wrap align-center justify-between flex-sub bindMobile_fd0_0'>
				<view class='flex flex-wrap align-center bindMobile_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
					data-url="1">
					<image class='bindMobile_fd0_0_c0_c0' mode="aspectFit" :src='STATIC_URL+"58.png"'></image>
				</view>
				<view class='flex flex-wrap align-stretch justify-center flex-sub bindMobile_fd0_0_c1'>
				</view>
				<view class='flex flex-wrap align-center bindMobile_fd0_0_c2'>
				</view>
			</view>

		</view>
		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
		<!---logoflex布局开始-->
		<view class="flex flex-direction flex-wrap align-center justify-center benben-flex-layout bindMobile_flex_1">
			<image class='bindMobile_fd1_0' mode="aspectFit" :src='STATIC_URL+"61.png"'></image>
		</view>
		<!---logoflex布局结束-->
		<!---登录flex布局开始-->
		<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout bindMobile_flex_2">
			<view class='flex flex-wrap align-center bindMobile_fd2_0'>
				<image class='bindMobile_fd2_0_c0' mode="aspectFit" :src='STATIC_URL+"101.png"'></image>
				<input class='flex-sub bindMobile_fd2_0_c1' type="number" placeholder="请输入手机号" confirm-type="done"
					:maxlength="11" placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx" v-model="moblie" />
			</view>
			<view class='flex align-center bindMobile_fd2_1'>
				<image class='bindMobile_fd2_1_c0' mode="aspectFit" :src='STATIC_URL+"102.png"'></image>
				<input class='flex-sub bindMobile_fd2_1_c1' type="number" placeholder="请输入验证码" confirm-type="done"
					:maxlength="6" placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx" v-model="code" />
				<benben-send-verification-code class='flex  bindMobile_fd2_1_c2' after-text='后重新获取' before-text='获取验证码'
					type='7' :phone="moblie"></benben-send-verification-code>
			</view>
			<view class='flex flex-wrap align-center bindMobile_fd2_2'>
				<image class='bindMobile_fd2_2_c0' mode="aspectFit" :src='STATIC_URL+"110.png"'></image>
				<benben-flex-password-diy v-model="password"
					class-name="flex align-center flex-sub flex bindMobile_fd2_2_c1" :placeholder="'请输入密码(6~12位字母+数字)'"
					:maxlength="12" :default-type='true'
					placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx">
					<template #show>
						<text class='fu-iconfont2  bindMobile_fd2_2_c1_icon1' data-type="show">&#xE837;</text>
					</template>
					<template #hide>
						<text class='fu-iconfont2  bindMobile_fd2_2_c1_icon2' data-type="hide">&#xEBCC;</text>
					</template>
				</benben-flex-password-diy>
			</view>
			<view class='flex align-center justify-center'>
				<button class='bindMobile_fd2_3_c0' @tap.stop="skipFunc()">确定</button>
			</view>
		</view>
		<!---登录flex布局结束-->


	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'
	export default {
		components: {},


		data() {
			return {
				"moblie": "",
				"code": "",
				"user_token": "",
				"password": "",
				"check": false,
				"dataList": {},
				"weixinInfo": {}
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			this.weixinInfo = uni.getStorageSync('weixinInfo');
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//跳转
			async skipFunc() {
				if (!validate(this.moblie, 'require')) {
					this.$message.info('手机号不能为空');
					return false;
				}
				if (!validate(this.moblie, 'phone')) {
					this.$message.info('手机号格式不正确');
					return false;
				}
				if (!validate(this.code, 'require')) {
					this.$message.info('验证码不能为空');
					return false;
				}
				if (!validate(this.password, 'require')) {
					this.$message.info('密码不能为空');
					return false;
				}
				if (!validate(this.password, 'password')) {
					this.$message.info('密码格式不正确');
					return false;
				}
				//请求方法
				//数据验证
				
				let datadataList = await this.$api.post(global.apiUrls.post64366e6b34ec0, {
					unionId: this.weixinInfo.unionId,
					nickName: this.weixinInfo.nickName,
					gender: this.weixinInfo.gender,
					avatarUrl: this.weixinInfo.avatarUrl,
					mobile: this.moblie,
					code: this.code,
					type: '7',
					wx_openid: this.weixinInfo.openId,
					password: this.password
				});
				// console.log(datadataList);
				if (datadataList.data.code != 1) {
					this.$message.info(datadataList.data.msg);
					return
				}
				let infodataList = datadataList.data;
				this.dataList = infodataList.data
				this.$store.commit('updateUserInfo', this.dataList.userinfo)
				this.$store.commit('saveToken', this.dataList.userinfo.user_token);
				uni.$emit('appLoginSuccess');
				this.$message.info(datadataList.data.msg);
				
				setTimeout(() => {
					this.toHomeDiy();
				}, 800)
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: rgba(255, 255, 255, 1);
		background-size: 100% auto !important;
	}

	.bindMobile_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.bindMobile_fd0_0_c2 {
		width: 120rpx;
		height: 88rpx;
	}

	.bindMobile_fd0_0_c1 {
		height: 88rpx;
	}

	.bindMobile_fd0_0_c0_c0 {
		width: 18rpx;
		height: 32rpx;
	}

	.bindMobile_fd0_0_c0 {
		width: 120rpx;
		height: 88rpx;
	}

	.bindMobile_fd0_0 {
		margin: 0rpx 32rpx 0rpx 32rpx;
	}

	.bindMobile_flex_1 {
		padding: 62rpx 0rpx 80rpx 0rpx;
	}

	.bindMobile_fd1_0 {
		width: 180rpx;
		height: 180rpx;
		border-radius: 36rpx 36rpx 36rpx 36rpx;
	}

	.bindMobile_flex_2 {
		padding: 0rpx 56rpx 0rpx 56rpx;
	}

	.bindMobile_fd2_3_c0 {
		background: rgba(62, 128, 246, 1);
		border-radius: 64rpx 64rpx 64rpx 64rpx;
		font-size: 32rpx;
		color: #fff;
		height: 88rpx;
		line-height: 88rpx;
		font-weight: 500;
		width: 638rpx;
		margin: 245rpx 0rpx 0rpx 0rpx;
	}

	.bindMobile_fd2_2_c1_icon2 {
		text-align: center;
		font-size: 44rpx;
	}

	.bindMobile_fd2_2_c1_icon1 {
		text-align: center;
		font-size: 44rpx;
		font-weight: 400;
		color: rgba(153, 153, 153, 1);
	}

	::v-deep .bindMobile_fd2_2_c1 {
		font-size: 32rpx;
		color: #333;
		font-weight: 400;
		width: 568rpx;
	}

	.bindMobile_fd2_2_c0 {
		width: 34rpx;
		height: 34rpx;
		margin: 0rpx 28rpx 0rpx 0rpx;
	}

	.bindMobile_fd2_2 {
		border-bottom: 1px solid #eee;
		padding: 40rpx 0rpx 40rpx 0rpx;
	}

	.bindMobile_fd2_1_c2 {
		line-height: 40rpx;
		font-size: 28rpx;
		color: rgba(62, 128, 246, 1);
		font-weight: 500;
	}

	.bindMobile_fd2_1_c1 {
		line-height: 45rpx;
		font-size: 32rpx;
		font-weight: 400;
		color: #333;
	}

	.bindMobile_fd2_1_c0 {
		width: 34rpx;
		height: 34rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 28rpx 0rpx 0rpx;
	}

	.bindMobile_fd2_1 {
		border-bottom: 1px solid #eee;
		padding: 40rpx 0rpx 40rpx 0rpx;
	}

	.bindMobile_fd2_0_c1 {
		line-height: 45rpx;
		font-size: 32rpx;
		font-weight: 400;
		color: #333;
	}

	.bindMobile_fd2_0_c0 {
		width: 34rpx;
		height: 34rpx;
		margin: 0rpx 28rpx 0rpx 0rpx;
	}

	.bindMobile_fd2_0 {
		border-bottom: 1px solid #eee;
		padding: 40rpx 0rpx 40rpx 0rpx;
	}
</style>
